package de.pass.ch.datastr;

/**
 * Encapsulates data that is associated with a node that is in the pqueue (for a
 * certain search direction).
 */
public class PQueueNode {

	/** The id of the node this object is associated with. */
	private int _nodeID; // possibility to save memory: use parentEdge.target()
	/** The id of the parent node. */
	private int _parentNode;
	/** The id of the edge that leads from the parent to this node. */
	private int _parentEdge;

	public PQueueNode() {
		_nodeID = 0;
		_parentNode = 0;
		_parentEdge = 0;
	}

	/**
	 * Initializes this object.
	 * 
	 * @param nodeID
	 *            - the id of the node this object is associated with
	 */
	public void init(int nodeID) {
		_nodeID = nodeID;
	}

	/**
	 * Marks that this node is the start node of a search. This is done by
	 * setting the parent pointer so that a self-loop is created.
	 */
	public void setStartNode() {
		_parentNode = _nodeID;
	}

	public boolean isStartNode() {
		return (_parentNode == _nodeID);
	}

	/**
	 * Set a new parent for this node.
	 * 
	 * @param parentNode
	 *            the parent node
	 * @param parentEdge
	 *            the edge that leads from the parent to this node
	 */
	public void updateParent(int parentNode, int parentEdge) {
		_parentNode = parentNode;
		_parentEdge = parentEdge;
	}

	/** Returns the id of the node this object is associated with. */
	public int nodeID() {
		return _nodeID;
	}

	/** Returns the id of the parent node. */
	public int parentNode() {
		return _parentNode;
	}

	/** Returns the id of the edge that leads from the parent to this node. */
	public int parentEdge() {
		return _parentEdge;
	}

	/**
	 * The stalling concept is only used in case of the HNR query. In
	 * PQueueNodeDynQuery, this method is overwritten appropriately. In all
	 * other cases (in particular during a HH query), there are NO stalled
	 * nodes.
	 * 
	 * @see DijkstraTemplate::obtainRelevantSearchSpace
	 */
	public boolean stalled() {
		return false;
	}

	// The following dummy methods are required to provide the same interface
	// in all PQueueNode subclasses so that the compiler does not complain.
	// These dummy methods are never called.
	public boolean isCovered() {
		assert (false);
		return false;
	}

	public void unstall() {
		assert (false);
	}

	public int stallKey() {
		assert (false);
		return 0;
	}

	public void stallKey(int k) {
		assert (false);
	}

	public int hwyNodeCount() {
		assert (false);
		return 0;
	}

	public void setHwyNodeCount(int c) {
		assert (false);
	}

	public void incHwyNodeCount() {
		assert (false);
	}

	public void setMaverick() {
		assert (false);
	}

	public boolean isActive() {
		assert (false);
		return false;
	}

	public void setActive(boolean act) {
		assert (false);
	}

	public void setLevel(int level, int dist) {
		assert (false);
	}

	public int level() {
		assert (false);
		return 0;
	}

	public int distanceToLevelBorder() {
		assert (false);
		return 0;
	}

	public int potential() {
		assert (false);
		return 0;
	}

	public void setPotential(int pot) {
		assert (false);
	}

	public void next(int n) {
		assert (false);
	}

	public int next() {
		assert (false);
		return 0;
	}

	public boolean isTarget() {
		assert (false);
		return false;
	}

	public void setTarget(boolean value) {
		assert (false);
	}

	public boolean isEliminated() {
		assert (false);
		return false;
	}

	public void setEliminated(boolean value) {
		assert (false);
	}

	public int hops() {
		assert (false);
		return 0;
	}

	public void setHops(int v) {
		assert (false);
	}

}
